package com.antler.smt.admin.controller;

import com.antler.smt.admin.annotation.OperateCut;
import com.antler.smt.admin.mapper.SupplierInfoMapper;
import com.antler.smt.response.base.Result;
import com.antler.smt.utils.LogUtil;
import com.antler.smt.validate.DataValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 获取优质加工厂集合
 *
 * @author zhangyi
 * @date 2018/5/25 13:59
 */
@RestController
@RequestMapping("/highQuality")
@Api(description = "获取的是优质加工厂的集合，通过优质加工厂名来获取信息")
public class HighQualitySupplierController extends BaseController {

    /**
     * 日志
     */
    private static Logger log = LogUtil.get();

    @Resource
    private SupplierInfoMapper supplierInfoMapper;

    /**
     * 获取优质加工厂集合
     *
     * @return Result实体
     */
    @GetMapping("/getSupplierSeekInfo")
    @ApiOperation(value = "获取优质加工厂列表", httpMethod = "GET")
    @OperateCut(content = "获取优质加工厂列表")
    public Result getSupplierInfo(@RequestParam(value = "name") String supplierName) {
        DataValidator.isBlank(supplierName,"服务商名不能为空！");
        Result result = null;
        result = new Result(supplierInfoMapper.getSupplierByName(supplierName));
        return result;
    }
}
